import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'

import reducer from '../redux/reducers'

const middleware = [ thunk ]

export default (initialState) => {
  const store = createStore(
    reducer,
    applyMiddleware(...middleware)
  )
  return store
}
